<?php
include('config.php');

$where = 1;
$name = isset($_GET['name_name']) ? $_GET['name_name'] : '';
$type_name = isset($_GET['type_name']) ? $_GET['type_name'] : '';
if($type_name && $type_name!="全选"){
	$type_id_rs = $mysql->selectlist("type","type_name='{$type_name}'");
	$type_id = $type_id_rs[0]['type_id'];
	$where = "n.type_id = '{$type_id}'";
}
if((($type_name&&$type_name!="全选")&&($name&&$name!="全选")) || ($name&&$name!="全选") ){
	$breed_id_rs = $mysql->selectlist("breed","breed_name='{$name}'");
	$breed_id = $breed_id_rs[0]['breed_id'];
	$where = "n.breed_id = '{$breed_id}'";
}
$sql = "SELECT n.*,b.breed_name,t.type_name FROM `number` n left join breed b on n.breed_id=b.breed_id left join type t on n.type_id=t.type_id";
$sql = $sql." where ".$where." ORDER BY n.number_id DESC LIMIT 0,15";
$rs = $mysql->execute($sql);
$array = array();
$n=0;
while  ($row = mysql_fetch_assoc($rs)){
	$n = $n;
	$num = $n%2;
	$row['num'] = $num;
	$array[] = $row;
	$n++;
}
$smarty->assign('link', 7);
$smarty->assign('arr',$array);
$smarty->display("type.html");